1. Field of the Invention
The present invention relates to a cache coherency maintaining method for a database management system (DBMS) operating in a shared disk multisystem, and more particularly, to a buffer allocation method of supporting a detection-based consistency maintenance policy and an avoidance-based consistency maintenance policy in a shared disk-based multi-DBMS improved in which an optimal procedure for each type is selectable by using the characteristic of the DBMS controlled coherently by units of table, block and record and the respective procedures coexist to obtain more improved performance.
2. Discussion of the Related Art
Generally, when it is required to cache the same data in two or more systems, a cache consistency maintenance procedure is used to prevent cached contents from being inconsistent with each other, and is used as an essential procedure in a shared disk-based file system, a client server DBMS, a parallel DBMS, a cluster DBMS, etc.
A database management system 10 managed in the conventional single system includes a DBMS 11, a file manager 12, a buffer manager 13, a buffer 14, a storage device 15, a log device 16 and a locking manager 17. In this system, since a unit of cache is a block used as a unit for input/output from/to a storage device, the cache consistency maintenance is performed in the block unit. In other words, when an access to a buffer is performed to read and update a disk block in the specific system, the buffer manager is ensured to provide the recent contents.
Various methods for this scheme are being proposed currently. Rahm E. divided a block-based consistency maintenance scheme into a detection-based scheme and an avoidance-based scheme in the paper entitled “Concurrency and Coherency Control in Database Sharing Systems”, Technical Report ZRI 3/91, University of Kaiserslautern, Dept. of Computer Science.
In the detection-based scheme, upon access to a buffer, if there is a block cached in the buffer, it is checked whether or not the block is proper to use according to some criterion. If the block is improper to use, the block of a most recent version is loaded by a predetermined procedure. In this scheme, when updated, only the information that the block has been updated is propagated to each system or kept at a shared area to keep the older version of the block cache. So, update propagation does not cost much.
There is a method to track whether or not a block was updated. In this method, the number of a recent version is kept at a specific location and is transferred to the buffer manager when accessing the buffer. The transferred number is compared with the number of a version of the cached block.
The paper discloses that the performance can be improved when the detection-based scheme is combined with locking by record. Generally, there are a few records in a block. Even though a specific record of a specific block is being updated, the block of the old version cached in the system can be used if another system accesses a record of the same block that is not being updated.
In this case, as a result of a record locking, the version number of the block required to access the record is transferred and this information is used to check validity of the block cached when buffer is loaded. This procedure is disclosed in the U.S. Pat. No. 5,327,556 entitled “Fast intersystem page transfer in a data sharing environment with record locking”. In the patent, the L-lock for record locking and the P-lock for authorizing to load page on buffer are used to describe the record level detection-based scheme.
However, this detection-based scheme cannot obtain information on version from lock result when accessing a record accompanied with table-based lock. In other words, table-based lock is obtained once before accessing all of the records in the table. Accordingly, whenever accessing a record, the version of the corresponding block should be obtained which is very inefficient.
In the avoidance-based scheme, when updating a buffer, caches of all the systems storing those of old version are invalidated and updated. The contents of the caches are propagated to the systems. This scheme costs much to update but it ensures that the blocks loaded in the buffers are always recent versions.
According to this scheme, if a specific block is being updated in a specific system, accessing the block is delayed in all the other systems until the block is updated completely. Instead, since it is not required to check the validity of the cached block, the procedure of obtaining a version number is not required before a buffer is allocated.
The avoidance-based scheme is proper to control consistency of the information read and updated block by block in DBMS. This information includes a system catalog block, index block, etc. The avoidance-based scheme is proper since these blocks are not allowed to be accessed.
The avoidance-based scheme can be used as a consistency maintenance method when accessing the record while locking a table. When this scheme is employed, it is not required to obtain the version information of the recent block before loading a buffer.
In the general DBMS, multi-granularity locking is employed in which table-based locking and record-based locking are used simultaneously. Therefore, to manage the table, detection-based scheme and avoidance-based scheme are used simultaneously according to a unit of locking.
These two methods should be applied interworking with each other using the same buffer space. If these two methods do not interwork with each other and use separate buffer spaces, the predictable problem is as follows.
First, when the specific block is allocated in the avoidance-based scheme, the specific block may be allocated in the same system and the other system in the detection-based scheme. In this case, the consistency of the cache of the database is deteriorated
Second, when the specific block is allocated in the detection-based update mode, it can be allocated in the avoidance-based read mode. So, problems may occur in the avoidance-based consistency control.
Third, when the specific block is allocated in the avoidance-based update mode, other systems can access the specific block in the detection-based read mode. So, problems may occur in the avoidance-based consistency control.
Accordingly, in the procedure to maintain cache consistency for DBMS, the two schemes should be supported and interwork with each other but there is no consistency maintenance procedure to meet these requirements now.